package io.jsen.meta.diff.feature.parser;

import com.google.common.collect.Maps;
import io.jsen.meta.diff.feature.annotation.FeatureConfig;

import java.lang.reflect.Field;
import java.util.Map;

/**
 *
 * 支持注入配置
 *
 * @author jsen
 * @date 2021/09/18
 **/
public class MetaFieldConfigInject {
    private static final Map<Field, FeatureConfig> FIELD_CONFIG = Maps.newHashMap();
    private static final Map<Class<?>, FeatureConfig> CLASS_CONFIG = Maps.newHashMap();

    public static void registerJsonConfig(String res) {
        // TODO 支持文件配置加载
    }

    public static FeatureConfig getFeatureConfig(Field field) {
        return FIELD_CONFIG.get(field);
    }

    public static FeatureConfig getFeatureConfig(Class<?> clazz) {
        return CLASS_CONFIG.get(clazz);
    }
}
